package protocol.transactions;

import protocol.XoneProtocol;
import protocol.XoneServiceCode;
import protocol.transactions.TransactionUpload.UploadPrama;

import com.google.gson.JsonElement;
import com.netease.http.THttpRequest;


public class TransactionPostDiscuss extends XoneBaseTransaction {
    private String mContent;
    private String mImageUrl;
    private UploadPrama mAudio;
    
    public TransactionPostDiscuss(String content, String imageUrl, UploadPrama audio) {
        super(TRANSACTION_TYPE_POSTDISCUSS);
        this.mContent = content;
        this.mImageUrl = imageUrl;
        this.mAudio = audio;
    }

    @Override
    protected void onXoneTransactionSuccess(int code, Object obj) {
        if (obj instanceof JsonElement) {
            notifyMessage(XoneServiceCode.TRANSACTION_SUCCESS, null);
        }
    }
    
    @Override
    public void onTransact() {
        THttpRequest request = XoneProtocol.getInstance().createPostDiscuss(mContent, mImageUrl, mAudio);
        sendRequest(request);
    }

}
